<template>
  <div>
      <div class="register">
    <van-nav-bar
      title="我的资料"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-field
      :placeholder="this.data.username"
      label="用户名"
      input-align="right"
    />
    <van-field
      :placeholder="this.data.email"
      label="电子邮箱"
      input-align="right"
    />

    <van-field
      readonly
      label="国家/地区"
      :placeholder="this.data.nation"
      input-align="right"
    />

    <van-field
      label="真实姓名"
      input-align="right"
      :placeholder="this.data.realname"
    />
    <van-field
      label="证件类型"
      input-align="right"
      :placeholder="this.data.idtype"
      id="zjlx"
      readonly
    />
    <van-field
      label="身份证号"
      input-align="right"
      :placeholder="this.idnum"
    />
    <!-- 性别 -->
    <van-field
      label="性别"
      readonly
      :placeholder="this.data.gender==1?'男':'女'"
      input-align="right"
    />
    <!-- 生日 -->
    <van-field
      label="出生日期"
      input-align="right"
      :placeholder="this.data.birthday"
      readonly
    />
    <van-field
      type="tel"
      label="手机"
      :placeholder="this.data.phone"
      input-align="right"
    />
  </div>
  </div>
</template>
<script>
export default {
   data() {
    return {
      data:'',
      idnum:''
    }
  },
  mounted(){
  this.data=this.$store.state.userData
  this.idnumChange()
  },
  methods:{
    onClickLeft(){
      this.$router.go(-1)
    },
    idnumChange(){
      let reg =/(\d{4})(\d{10})([a-zA-Z0-9]{4})/
      this.idnum=this.data.idnum.replace(reg,"$1******$3")
    }
  },
}
</script>
